﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Migrations
{
    /// <inheritdoc />
    public partial class modify_table_name_main : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_DATA_DICT_DATA_DICT_TYPE_DataDictTypeId",
                table: "DATA_DICT");

            migrationBuilder.DropForeignKey(
                name: "FK_DEPT_ASSOC_ATTR_DEPT_INFO_DeptInfoId",
                table: "DEPT_ASSOC_ATTR");

            migrationBuilder.DropForeignKey(
                name: "FK_DEPT_INFO_DEPT_INFO_ParentId",
                table: "DEPT_INFO");

            migrationBuilder.DropForeignKey(
                name: "FK_MSG_READ_REC_MSG_SEND_REC_MsgSendRecId",
                table: "MSG_READ_REC");

            migrationBuilder.DropForeignKey(
                name: "FK_MSG_SEND_REC_MSG_BIZ_TYPE_MsgBizTypeId",
                table: "MSG_SEND_REC");

            migrationBuilder.DropForeignKey(
                name: "FK_PSN_INFO_PosInfos_PosInfoId",
                table: "PSN_INFO");

            migrationBuilder.DropForeignKey(
                name: "FK_SYS_MENU_SYS_MENU_ParentId",
                table: "SYS_MENU");

            migrationBuilder.DropForeignKey(
                name: "FK_SYS_MENU_ACL_ABILITY_SYS_MENU_SysMenuId",
                table: "SYS_MENU_ACL_ABILITY");

            migrationBuilder.DropForeignKey(
                name: "FK_SYS_MENU_ACL_ROLE_SYS_MENU_SysMenuId",
                table: "SYS_MENU_ACL_ROLE");

            migrationBuilder.DropPrimaryKey(
                name: "PK_SYS_MENU_ACL_ROLE",
                table: "SYS_MENU_ACL_ROLE");

            migrationBuilder.DropPrimaryKey(
                name: "PK_SYS_MENU_ACL_ABILITY",
                table: "SYS_MENU_ACL_ABILITY");

            migrationBuilder.DropPrimaryKey(
                name: "PK_SYS_MENU",
                table: "SYS_MENU");

            migrationBuilder.DropPrimaryKey(
                name: "PK_STD_WORD_DICT",
                table: "STD_WORD_DICT");

            migrationBuilder.DropPrimaryKey(
                name: "PK_PSN_INFO",
                table: "PSN_INFO");

            migrationBuilder.DropPrimaryKey(
                name: "PK_PosInfos",
                table: "PosInfos");

            migrationBuilder.DropPrimaryKey(
                name: "PK_ORGAN_INFO",
                table: "ORGAN_INFO");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MSG_SEND_REC",
                table: "MSG_SEND_REC");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MSG_READ_REC",
                table: "MSG_READ_REC");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MSG_BIZ_TYPE",
                table: "MSG_BIZ_TYPE");

            migrationBuilder.DropPrimaryKey(
                name: "PK_DEPT_INFO",
                table: "DEPT_INFO");

            migrationBuilder.DropPrimaryKey(
                name: "PK_DEPT_ASSOC_ATTR",
                table: "DEPT_ASSOC_ATTR");

            migrationBuilder.DropPrimaryKey(
                name: "PK_DATA_DICT_TYPE",
                table: "DATA_DICT_TYPE");

            migrationBuilder.DropPrimaryKey(
                name: "PK_DATA_DICT",
                table: "DATA_DICT");

            migrationBuilder.DropPrimaryKey(
                name: "PK_BIZ_SEQ",
                table: "BIZ_SEQ");

            migrationBuilder.RenameTable(
                name: "SYS_MENU_ACL_ROLE",
                newName: "MainSysMenuAclRole");

            migrationBuilder.RenameTable(
                name: "SYS_MENU_ACL_ABILITY",
                newName: "MainSysMenuAclAbility");

            migrationBuilder.RenameTable(
                name: "SYS_MENU",
                newName: "MainSysMenu");

            migrationBuilder.RenameTable(
                name: "STD_WORD_DICT",
                newName: "MainStdWordDict");

            migrationBuilder.RenameTable(
                name: "PSN_INFO",
                newName: "MainPsnInfo");

            migrationBuilder.RenameTable(
                name: "PosInfos",
                newName: "MainPosInfo");

            migrationBuilder.RenameTable(
                name: "ORGAN_INFO",
                newName: "MainOrganInfo");

            migrationBuilder.RenameTable(
                name: "MSG_SEND_REC",
                newName: "MainMsgSendRec");

            migrationBuilder.RenameTable(
                name: "MSG_READ_REC",
                newName: "MainMsgReadRec");

            migrationBuilder.RenameTable(
                name: "MSG_BIZ_TYPE",
                newName: "MainMsgBizType");

            migrationBuilder.RenameTable(
                name: "DEPT_INFO",
                newName: "MainDeptInfo");

            migrationBuilder.RenameTable(
                name: "DEPT_ASSOC_ATTR",
                newName: "MainDeptAssocAttr");

            migrationBuilder.RenameTable(
                name: "DATA_DICT_TYPE",
                newName: "MainDataDictType");

            migrationBuilder.RenameTable(
                name: "DATA_DICT",
                newName: "MainDataDict");

            migrationBuilder.RenameTable(
                name: "BIZ_SEQ",
                newName: "MainBizSeq");

            migrationBuilder.RenameIndex(
                name: "IX_SYS_MENU_ACL_ROLE_SysMenuId",
                table: "MainSysMenuAclRole",
                newName: "IX_MainSysMenuAclRole_SysMenuId");

            migrationBuilder.RenameIndex(
                name: "IX_SYS_MENU_ACL_ABILITY_SysMenuId",
                table: "MainSysMenuAclAbility",
                newName: "IX_MainSysMenuAclAbility_SysMenuId");

            migrationBuilder.RenameIndex(
                name: "IX_SYS_MENU_ParentId",
                table: "MainSysMenu",
                newName: "IX_MainSysMenu_ParentId");

            migrationBuilder.RenameIndex(
                name: "IX_PSN_INFO_PosInfoId",
                table: "MainPsnInfo",
                newName: "IX_MainPsnInfo_PosInfoId");

            migrationBuilder.RenameIndex(
                name: "IX_MSG_SEND_REC_MsgBizTypeId",
                table: "MainMsgSendRec",
                newName: "IX_MainMsgSendRec_MsgBizTypeId");

            migrationBuilder.RenameIndex(
                name: "IX_MSG_READ_REC_MsgSendRecId",
                table: "MainMsgReadRec",
                newName: "IX_MainMsgReadRec_MsgSendRecId");

            migrationBuilder.RenameIndex(
                name: "IX_DEPT_INFO_ParentId",
                table: "MainDeptInfo",
                newName: "IX_MainDeptInfo_ParentId");

            migrationBuilder.RenameIndex(
                name: "IX_DEPT_ASSOC_ATTR_DeptInfoId",
                table: "MainDeptAssocAttr",
                newName: "IX_MainDeptAssocAttr_DeptInfoId");

            migrationBuilder.RenameIndex(
                name: "IX_DATA_DICT_DataDictTypeId",
                table: "MainDataDict",
                newName: "IX_MainDataDict_DataDictTypeId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainSysMenuAclRole",
                table: "MainSysMenuAclRole",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainSysMenuAclAbility",
                table: "MainSysMenuAclAbility",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainSysMenu",
                table: "MainSysMenu",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainStdWordDict",
                table: "MainStdWordDict",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainPsnInfo",
                table: "MainPsnInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainPosInfo",
                table: "MainPosInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainOrganInfo",
                table: "MainOrganInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainMsgSendRec",
                table: "MainMsgSendRec",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainMsgReadRec",
                table: "MainMsgReadRec",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainMsgBizType",
                table: "MainMsgBizType",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainDeptInfo",
                table: "MainDeptInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainDeptAssocAttr",
                table: "MainDeptAssocAttr",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainDataDictType",
                table: "MainDataDictType",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainDataDict",
                table: "MainDataDict",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MainBizSeq",
                table: "MainBizSeq",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_MainSysMenu_MENU_CODE",
                table: "MainSysMenu",
                column: "MENU_CODE");

            migrationBuilder.AddForeignKey(
                name: "FK_MainDataDict_MainDataDictType_DataDictTypeId",
                table: "MainDataDict",
                column: "DataDictTypeId",
                principalTable: "MainDataDictType",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainDeptAssocAttr_MainDeptInfo_DeptInfoId",
                table: "MainDeptAssocAttr",
                column: "DeptInfoId",
                principalTable: "MainDeptInfo",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MainDeptInfo_MainDeptInfo_ParentId",
                table: "MainDeptInfo",
                column: "ParentId",
                principalTable: "MainDeptInfo",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MainMsgReadRec_MainMsgSendRec_MsgSendRecId",
                table: "MainMsgReadRec",
                column: "MsgSendRecId",
                principalTable: "MainMsgSendRec",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainMsgSendRec_MainMsgBizType_MsgBizTypeId",
                table: "MainMsgSendRec",
                column: "MsgBizTypeId",
                principalTable: "MainMsgBizType",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainPsnInfo_MainPosInfo_PosInfoId",
                table: "MainPsnInfo",
                column: "PosInfoId",
                principalTable: "MainPosInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainSysMenu_MainSysMenu_ParentId",
                table: "MainSysMenu",
                column: "ParentId",
                principalTable: "MainSysMenu",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MainSysMenuAclAbility_MainSysMenu_SysMenuId",
                table: "MainSysMenuAclAbility",
                column: "SysMenuId",
                principalTable: "MainSysMenu",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MainSysMenuAclRole_MainSysMenu_SysMenuId",
                table: "MainSysMenuAclRole",
                column: "SysMenuId",
                principalTable: "MainSysMenu",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MainDataDict_MainDataDictType_DataDictTypeId",
                table: "MainDataDict");

            migrationBuilder.DropForeignKey(
                name: "FK_MainDeptAssocAttr_MainDeptInfo_DeptInfoId",
                table: "MainDeptAssocAttr");

            migrationBuilder.DropForeignKey(
                name: "FK_MainDeptInfo_MainDeptInfo_ParentId",
                table: "MainDeptInfo");

            migrationBuilder.DropForeignKey(
                name: "FK_MainMsgReadRec_MainMsgSendRec_MsgSendRecId",
                table: "MainMsgReadRec");

            migrationBuilder.DropForeignKey(
                name: "FK_MainMsgSendRec_MainMsgBizType_MsgBizTypeId",
                table: "MainMsgSendRec");

            migrationBuilder.DropForeignKey(
                name: "FK_MainPsnInfo_MainPosInfo_PosInfoId",
                table: "MainPsnInfo");

            migrationBuilder.DropForeignKey(
                name: "FK_MainSysMenu_MainSysMenu_ParentId",
                table: "MainSysMenu");

            migrationBuilder.DropForeignKey(
                name: "FK_MainSysMenuAclAbility_MainSysMenu_SysMenuId",
                table: "MainSysMenuAclAbility");

            migrationBuilder.DropForeignKey(
                name: "FK_MainSysMenuAclRole_MainSysMenu_SysMenuId",
                table: "MainSysMenuAclRole");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainSysMenuAclRole",
                table: "MainSysMenuAclRole");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainSysMenuAclAbility",
                table: "MainSysMenuAclAbility");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainSysMenu",
                table: "MainSysMenu");

            migrationBuilder.DropIndex(
                name: "IX_MainSysMenu_MENU_CODE",
                table: "MainSysMenu");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainStdWordDict",
                table: "MainStdWordDict");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainPsnInfo",
                table: "MainPsnInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainPosInfo",
                table: "MainPosInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainOrganInfo",
                table: "MainOrganInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainMsgSendRec",
                table: "MainMsgSendRec");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainMsgReadRec",
                table: "MainMsgReadRec");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainMsgBizType",
                table: "MainMsgBizType");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainDeptInfo",
                table: "MainDeptInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainDeptAssocAttr",
                table: "MainDeptAssocAttr");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainDataDictType",
                table: "MainDataDictType");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainDataDict",
                table: "MainDataDict");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MainBizSeq",
                table: "MainBizSeq");

            migrationBuilder.RenameTable(
                name: "MainSysMenuAclRole",
                newName: "SYS_MENU_ACL_ROLE");

            migrationBuilder.RenameTable(
                name: "MainSysMenuAclAbility",
                newName: "SYS_MENU_ACL_ABILITY");

            migrationBuilder.RenameTable(
                name: "MainSysMenu",
                newName: "SYS_MENU");

            migrationBuilder.RenameTable(
                name: "MainStdWordDict",
                newName: "STD_WORD_DICT");

            migrationBuilder.RenameTable(
                name: "MainPsnInfo",
                newName: "PSN_INFO");

            migrationBuilder.RenameTable(
                name: "MainPosInfo",
                newName: "PosInfos");

            migrationBuilder.RenameTable(
                name: "MainOrganInfo",
                newName: "ORGAN_INFO");

            migrationBuilder.RenameTable(
                name: "MainMsgSendRec",
                newName: "MSG_SEND_REC");

            migrationBuilder.RenameTable(
                name: "MainMsgReadRec",
                newName: "MSG_READ_REC");

            migrationBuilder.RenameTable(
                name: "MainMsgBizType",
                newName: "MSG_BIZ_TYPE");

            migrationBuilder.RenameTable(
                name: "MainDeptInfo",
                newName: "DEPT_INFO");

            migrationBuilder.RenameTable(
                name: "MainDeptAssocAttr",
                newName: "DEPT_ASSOC_ATTR");

            migrationBuilder.RenameTable(
                name: "MainDataDictType",
                newName: "DATA_DICT_TYPE");

            migrationBuilder.RenameTable(
                name: "MainDataDict",
                newName: "DATA_DICT");

            migrationBuilder.RenameTable(
                name: "MainBizSeq",
                newName: "BIZ_SEQ");

            migrationBuilder.RenameIndex(
                name: "IX_MainSysMenuAclRole_SysMenuId",
                table: "SYS_MENU_ACL_ROLE",
                newName: "IX_SYS_MENU_ACL_ROLE_SysMenuId");

            migrationBuilder.RenameIndex(
                name: "IX_MainSysMenuAclAbility_SysMenuId",
                table: "SYS_MENU_ACL_ABILITY",
                newName: "IX_SYS_MENU_ACL_ABILITY_SysMenuId");

            migrationBuilder.RenameIndex(
                name: "IX_MainSysMenu_ParentId",
                table: "SYS_MENU",
                newName: "IX_SYS_MENU_ParentId");

            migrationBuilder.RenameIndex(
                name: "IX_MainPsnInfo_PosInfoId",
                table: "PSN_INFO",
                newName: "IX_PSN_INFO_PosInfoId");

            migrationBuilder.RenameIndex(
                name: "IX_MainMsgSendRec_MsgBizTypeId",
                table: "MSG_SEND_REC",
                newName: "IX_MSG_SEND_REC_MsgBizTypeId");

            migrationBuilder.RenameIndex(
                name: "IX_MainMsgReadRec_MsgSendRecId",
                table: "MSG_READ_REC",
                newName: "IX_MSG_READ_REC_MsgSendRecId");

            migrationBuilder.RenameIndex(
                name: "IX_MainDeptInfo_ParentId",
                table: "DEPT_INFO",
                newName: "IX_DEPT_INFO_ParentId");

            migrationBuilder.RenameIndex(
                name: "IX_MainDeptAssocAttr_DeptInfoId",
                table: "DEPT_ASSOC_ATTR",
                newName: "IX_DEPT_ASSOC_ATTR_DeptInfoId");

            migrationBuilder.RenameIndex(
                name: "IX_MainDataDict_DataDictTypeId",
                table: "DATA_DICT",
                newName: "IX_DATA_DICT_DataDictTypeId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_SYS_MENU_ACL_ROLE",
                table: "SYS_MENU_ACL_ROLE",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_SYS_MENU_ACL_ABILITY",
                table: "SYS_MENU_ACL_ABILITY",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_SYS_MENU",
                table: "SYS_MENU",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_STD_WORD_DICT",
                table: "STD_WORD_DICT",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_PSN_INFO",
                table: "PSN_INFO",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_PosInfos",
                table: "PosInfos",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ORGAN_INFO",
                table: "ORGAN_INFO",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MSG_SEND_REC",
                table: "MSG_SEND_REC",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MSG_READ_REC",
                table: "MSG_READ_REC",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MSG_BIZ_TYPE",
                table: "MSG_BIZ_TYPE",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_DEPT_INFO",
                table: "DEPT_INFO",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_DEPT_ASSOC_ATTR",
                table: "DEPT_ASSOC_ATTR",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_DATA_DICT_TYPE",
                table: "DATA_DICT_TYPE",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_DATA_DICT",
                table: "DATA_DICT",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_BIZ_SEQ",
                table: "BIZ_SEQ",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_DATA_DICT_DATA_DICT_TYPE_DataDictTypeId",
                table: "DATA_DICT",
                column: "DataDictTypeId",
                principalTable: "DATA_DICT_TYPE",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_DEPT_ASSOC_ATTR_DEPT_INFO_DeptInfoId",
                table: "DEPT_ASSOC_ATTR",
                column: "DeptInfoId",
                principalTable: "DEPT_INFO",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_DEPT_INFO_DEPT_INFO_ParentId",
                table: "DEPT_INFO",
                column: "ParentId",
                principalTable: "DEPT_INFO",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MSG_READ_REC_MSG_SEND_REC_MsgSendRecId",
                table: "MSG_READ_REC",
                column: "MsgSendRecId",
                principalTable: "MSG_SEND_REC",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MSG_SEND_REC_MSG_BIZ_TYPE_MsgBizTypeId",
                table: "MSG_SEND_REC",
                column: "MsgBizTypeId",
                principalTable: "MSG_BIZ_TYPE",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PSN_INFO_PosInfos_PosInfoId",
                table: "PSN_INFO",
                column: "PosInfoId",
                principalTable: "PosInfos",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SYS_MENU_SYS_MENU_ParentId",
                table: "SYS_MENU",
                column: "ParentId",
                principalTable: "SYS_MENU",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_SYS_MENU_ACL_ABILITY_SYS_MENU_SysMenuId",
                table: "SYS_MENU_ACL_ABILITY",
                column: "SysMenuId",
                principalTable: "SYS_MENU",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SYS_MENU_ACL_ROLE_SYS_MENU_SysMenuId",
                table: "SYS_MENU_ACL_ROLE",
                column: "SysMenuId",
                principalTable: "SYS_MENU",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
